<?php
use \GatewayWorker\Lib\Gateway;

//重新登录（不是断网重连），进入旧房间：re enter room
class unbindgroup extends cmdbase
{

	public function onCmd($msg){
		$group_mgr = $GLOBALS['GroupMgr'];

 		$user_id = $this->getCurUid();

 		//看看用户id对应的组还存在不
 		$group_id = $group_mgr->getActiveGroupId($user_id);
 		 $msg_body = array();
 		if($group_id > 0){
 			$msg_body['ret'] = NetErrorCode::$None;
 			$msg_body['reason'] = "success";
 		}else{
 			$msg_body['ret'] = NetErrorCode::$Error;
 			$msg_body['reason'] = "unbind失败，强制unbind";
 		}

 		//unbinde
 		$group_mgr->deleteGroup($user_id);

 		return $msg_body;
	}
}